package com.example.demo.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.demo.entity.SchoolStudent;
import com.example.demo.service.SchoolStudentService;
import com.example.demo.mapper.SchoolStudentMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
* @author Administrator
* @description 针对表【school_student】的数据库操作Service实现
* @createDate 2022-07-30 14:31:14
*/
@Service
public class SchoolStudentServiceImpl extends ServiceImpl<SchoolStudentMapper, SchoolStudent>
    implements SchoolStudentService{

    @Autowired
    private SchoolStudentMapper schoolStudentMapper;

    @Override
    public List<SchoolStudent> getAllGirl(){
        SchoolStudent schoolStudent=new SchoolStudent();
        schoolStudent.setSex("女");

        LambdaQueryWrapper<SchoolStudent> queryWrapper=new LambdaQueryWrapper<>();
        queryWrapper.eq(SchoolStudent::getSex,"女");
        List<SchoolStudent> Result=this.schoolStudentMapper.selectList(queryWrapper);

        return Result;
    }

    public Integer deptCout(String dept){
        LambdaQueryWrapper<SchoolStudent> queryWrapper=new LambdaQueryWrapper<>();
        queryWrapper.eq(SchoolStudent::getDept,dept);
        Integer count=this.schoolStudentMapper.selectCount(queryWrapper);

        return count;
    }
}




